package org.order.controller;

import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.ajax.common.AjaxMap;
import org.order.api.OrderServiceApi;
import org.order.entity.DbOrder;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.alibaba.dubbo.config.annotation.Reference;

/**
 * wap首页
 * @author 王强
 */
@RestController
@CrossOrigin
public class OrderController {

	@Reference(version = "1.0.0", application = "${dubbo.application.id}", url = "dubbo://localhost:12347")
	private OrderServiceApi orderService;

	private HttpServletRequest req;
	
	
	public OrderController(HttpServletRequest req) {
		// TODO Auto-generated constructor stub
		this.req = req;

	}

	@RequestMapping("/getOrderList")
	public Map<String, ?> getOrderList() {
		
		List<DbOrder> adLIst = this.orderService.getOrder();
		
		return AjaxMap.getInstance(adLIst).getAjaxResultByMap();
	}
	
	@RequestMapping("/getOrderById")
	public Map<String, ?> getOrderById() {
		
		DbOrder adLIst = this.orderService.getOrderById();
		
		return AjaxMap.getInstance(adLIst).getAjaxResultByMap();
	}

}
